package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbItemMapper;
import com.dongdongshop.pojo.TbItem;
import com.dongdongshop.pojo.TbItemExample;
import com.dongdongshop.service.TbItemService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class TbItemServiceImpl implements TbItemService {

    @Resource
    private TbItemMapper tbItemMapper;
    //根据商家id 获取 商品 详细表
    @Override
    public List<TbItem> getItemListById(Long id) {
        TbItemExample tbItemExample = new TbItemExample();
        TbItemExample.Criteria criteria = tbItemExample.createCriteria();
        criteria.andGoodsIdEqualTo(id);
        return tbItemMapper.selectByExample(tbItemExample);
    }


    //根据主键id获取商品信息
    @Override
    public TbItem selectById(Long skuId) {
        return tbItemMapper.selectByPrimaryKey(skuId);
    }
}
